package com.gec.mybatisPlus.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

//@Getter
//@Setter
//@ToString
//@EqualsAndHashCode
@Data
@NoArgsConstructor
@AllArgsConstructor

public class User {
    //    设置自增
    @TableId(type = IdType.AUTO)
    private Long id;
    private String name;
    private Integer age;
    private String email;
    /*@TableField fill设置自动填充策略
     *fill = FieldFill.INSERT当插入语句的时候会自动填充
     * 会自动对_转驼峰命名法
     *  */
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    /*
    * 对mybatis-plus默认生成的sql中的插入和更新都会进行填充操作*/
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;
    @TableField(fill = FieldFill.INSERT)
    //乐观锁注解
    @Version
    private Integer version;
    @TableLogic //逻辑删除
    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;
}

